﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Negocio;

namespace Precentacion1
{
    public partial class frmCobranzas : Form
    {
        public frmCobranzas()
        {
            InitializeComponent();
            this.ConfigurarDataGridView(this.dataGridViewCobranzas);
            mostrate();
        }

        private void buttonBuscar_Click(object sender, EventArgs e)
        {

            mostrate();
        }
        public void mostrate()
        {
            this.dataGridViewCobranzas.DataSource = admCobranzas.BuscarCobranzas(this.textBoxDni.Text, /*this.dateTimePickerDesde.Value*/ "",/* this.dateTimePickerHasta.Value*/ "");
            this.dataGridViewCobranzas.Columns["idVenta"].Visible = false;
            this.dataGridViewCobranzas.Columns["CantidadVendida"].Visible = false;
        }
        private void ConfigurarDataGridView(DataGridView paramDataGridView)
        {
            paramDataGridView.ReadOnly = true;
            paramDataGridView.MultiSelect = false;
            paramDataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            paramDataGridView.RowHeadersVisible = false;
            paramDataGridView.AllowUserToResizeRows = false;
            paramDataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            paramDataGridView.AlternatingRowsDefaultCellStyle.BackColor = Color.AliceBlue;
        }

        private void buttonDetalle_Click(object sender, EventArgs e)
        {
            frmDetalleCobranza frmDetalleCob = new frmDetalleCobranza(Convert.ToInt32(this.dataGridViewCobranzas.SelectedRows[0].Cells["IdVenta"].Value));
            frmDetalleCob.Show();
            //mostrate();
            //frmDetalleCob.mostrate(Convert.ToInt32(this.dataGridViewCobranzas.SelectedRows[0].Cells["IdVenta"].Value));
        }

        private void frmCobranzas_Load(object sender, EventArgs e)
        {

        }

      

    

        
    }
}
